﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using KVB.Common;

namespace Customer_Profile.eCard.DBDao
{
    public class SettleAgentDao
    {
        public static DataSet getSettleAgentList(string if_all)
        {
            SqlConnection conn = null;
            DataSet ds = null;
            try
            {
                DB.Connection(ref conn);
                SqlParameter[] parameters = { new SqlParameter("@if_all", SqlDbType.VarChar, 50) };
                parameters[0].Value = if_all;
                ds = DB.ExecuteDataset(conn, CommandType.StoredProcedure, "eCard_SettleAgent_byall",parameters);
            }
            catch (Exception e)
            {
                KVB.Common.Log.WriteDefaultLog("SettleAgentDao.getSettleAgentList", e.Message);
            }
            finally
            {
                DB.ConnDispose(ref conn);
            }
            return ds;
        }

        public static DataSet getAgentProdList()
        {
            SqlConnection conn = null;
            DataSet ds = null;
            try
            {
                DB.Connection(ref conn);
                //SqlParameter[] parameters = { new SqlParameter("@if_all", SqlDbType.VarChar, 50) };
                //parameters[0].Value = if_all;
                ds = DB.ExecuteDataset(conn, CommandType.StoredProcedure, "eCard_SaleAgent_Prod");
            }
            catch (Exception e)
            {
                KVB.Common.Log.WriteDefaultLog("SettleAgentDao.getAgentProdList", e.Message);
            }
            finally
            {
                DB.ConnDispose(ref conn);
            }
            return ds;
        }
    }
}